<?php

namespace App\Http\Controllers;

use App\Models\BrotherCommunity;
use App\Models\Tag;
use App\Models\Topic;
use App\Models\Link;
use App\Models\Banner;
use Illuminate\Http\Request;

class TagsController extends Controller
{
    public function show($id, Request $request, Topic $topic)
    {
        $tag         = Tag::query()->findOrFail($id);
        $topics      = $topic->getTagsTopicsWithFilter($request->get('filter', 'default'), $tag->name);
        $links       = Link::allFromCache();
        $communities = BrotherCommunity::allFromCache();
        //$banners     = Banner::allByPosition();

        return view('tags.show', compact('tag', 'topics', 'links', 'communities', 'banners'));
    }
}
